package fileio

import (
	"fmt"
	"gitee.com/ykallan/go-common-util/handler"
	"os"
)

func WriteStringCreate(path, data string) {
	if _, err := os.Stat(path); err != nil {
		fmt.Println(err.Error())
		if os.IsNotExist(err) {
			file, err := os.OpenFile(path, os.O_CREATE|os.O_APPEND|os.O_RDWR, os.ModeAppend|os.ModePerm)
			defer file.Close()
			handler.PanicHandler(err, "创建文件失败")
			file.WriteString(data)
		} else {
			handler.ErrorHandler(err, "其他异常")
		}
	}
}

func WriteStringAppend(path string, data string) {

}
